<?php


class WSB_View_Helper_FormSelectCsvAdvImages extends WSB_View_Helper_FormSelectCsvAdv
{

	public function formSelectCsvAdvImages($name, $value = null, $attribs = null, $listsep = "<br />\n")
	{
        $info = $this->_getInfo($name, $value, $attribs, null, $listsep);
        extract($info); // name, id, value, attribs, options, listsep, disable

		return $this->formSelectCsvAdv($name, $value, $attribs, $listsep);
	}

	protected function _getAddLink()
	{
		$globals = array(
			'TEMPLATE' => 'popup',
			//'view' => 'browser',
			'opener' => array(
				'id' => 'formSelectCsvAdv',
				'selectId' => $this->_helperId,
				'elementId' => $this->_elementId
			),
			'filter' => 'image'
		);
		$href = WSB_Controller_Url::getUrl('file', 'browser', array(), 'media', $globals);
		return WSB_Controller_Url::getHtmlPopupLink('Add', $href, 500, 500);
	}

	protected function _getAdditionalHtml()
	{
		$html = '<div>';
		foreach($this->_helperOptions AS $image) {
			if(is_file(WSB_PATH . $image)) {
				$html .= sprintf('<img src="%s" height="40" alt="" /> ', WSB_URL . $image);
			}
		}
		$html .= '</div>';
		return $html;
	}

}